package JDBC.model;

import org.springframework.jdbc.object.MappingSqlQuery;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Fou Jack of all trades and master of none.
 * @date 2022/1/6 15:52
 */
public class UserMappingSqlQuery extends MappingSqlQuery<User> {
    @Override
    protected User mapRow(ResultSet rs, int rowNum) throws SQLException {
        User user = new User();
        user.setId((Integer)rs.getInt("id"));
        user.setName((String)rs.getString("name"));
        user.setAge((Integer)rs.getInt("age"));
        user.setMoney((Double)rs.getDouble("money"));
        return user;
    }


}
